# 使用递归实现汉诺塔
def solveTowerOfHanoi(num, a, b, c):
    if num == 1:
        print(a.__str__() + "移动至" + c.__str__())
    else:
        solveTowerOfHanoi(num-1, a, c, b)
        print(a.__str__() + "移动至" + c.__str__())
        solveTowerOfHanoi(num-1, b, a, c)


# 1: a->c2
# 2: a->b,a->c,b->c
num = int(input("请输入num:\t\n"))
solveTowerOfHanoi(num, "A", "B", "C")
